#ifndef GENMANITEM_H
#define GENMANITEM_H

#include <QtGui>
#include "shareheader.h"

class GenManItem: public QWidget
{
	Q_OBJECT

	public:
        GenManItem(QWidget *parent = 0);
		~GenManItem();

        std::string getIP();
        void setGenId(int genId);
        int getGenId();
		void setGenConfig(const TGenConfig& config);
		TGenConfig getGenConfig();
		
	private:
		int m_genId;
		TGenConfig m_genConfig;
		QHBoxLayout *horizontalLayout;
		QLineEdit *lineEdit;	// ip 
		QLabel *label;	// down or ready
		QLineEdit *lineEdit_2; // count
		QPushButton *pushButton; // connect
		QPushButton *pushButton_2; // delete

		void SetupUI();
		void Initialize();
		void MakeConnections();
		
	signals:
		void delGen(int genId);
		void genConfigChanged(int genId, const TGenConfig& config);
		void connectGen(int genId, TGenConfig config);

	public slots:
		void IpHandle();
		void CountHandle();

		void DelGenHandle();
		void ConnectHandle(); // connect button clicked
		void ConnectDoneHandle(int genId, int status); // connect done
};

#endif
